//
//  BasicTableViewCell.m
//  CToolBox
//
//  Created by crj on 16/8/11.
//  Copyright © 2016年 oyf. All rights reserved.
//

#import "BasicTableViewCell.h"
#import "UIView+Frame.h"

#define kLineTag 1000

@implementation BasicTableViewCell

- (instancetype)init
{
    self = [super init];
    if (self) {
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        [self.contentView addSubview:self.lineView];
    }
    return self;
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        [self.contentView addSubview:self.lineView];
    }
    return self;
}


- (void)awakeFromNib {
    [super awakeFromNib];
    self.selectionStyle = UITableViewCellSelectionStyleNone;
    [self.contentView addSubview:self.lineView];
}



- (void)layoutSubviews{
    
    [super layoutSubviews];
    _lineView.frame = CGRectMake(kSpaceSide, self.yj_height-kLineHeight, self.yj_width-kSpaceSide*2, kLineHeight);
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (UIView *)lineView{
    
    if(!_lineView){
        _lineView = [[UIView alloc] init];
        _lineView.tag = kLineTag;
        _lineView.backgroundColor = HEXCOLOR(kColorGray7, 1);
    }
    return _lineView;
}


+ (NSString *)reuseIdentifier;
{

    return NSStringFromClass(self);
}

//需要具体子类去重写
+ (CGFloat)cellHeight{
    
    return 0;
}

+ (void)registerClassForTableView:(UITableView *)tableView{

    [tableView registerClass:[self class] forCellReuseIdentifier:[self reuseIdentifier]];
}

@end
